//
//  RegisterSuccessView.swift
//  GreenDeal
//
//  Created by Moennig Q on 22/2/2023.
//

import UIKit
import SnapKit
class RegisterSuccessView: GreenNaviBarView {
    let okBtn = OperationButton(R.string.localizable.oK())
    override func setUpView() {
        //隐藏返回箭头
        self.backToPreBtn.isHidden = true
        //
        let contentView = UIView()
        contentView.backgroundColor = .white
        contentView.drawCorner(byRoundingCorners: [.topLeft,.topRight])
        self.addSubview(contentView)
        contentView.snp.makeConstraints { make in
            make.top.equalTo(self.topBackView.snp.bottom).offset(-20)
            make.left.right.bottom.equalToSuperview()
        }
        //
        let backView = UIView()
        contentView.addSubview(backView)
        backView.snp.makeConstraints { make in
            make.left.equalTo(40)
            make.right.equalTo(-40)
            make.height.greaterThanOrEqualTo(0)
            make.center.equalToSuperview()
        }
        //
        let successImageView = UIImageView(image: R.image.register_success_icon())
        backView.addSubview(successImageView)
        successImageView.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.height.equalTo(192)
            make.width.equalTo(240)
            make.centerX.equalToSuperview()
        }
        //
        //tip one
        let tipOneLabel = ContentLabel(R.font.interBold(size: 18))
        tipOneLabel.text = R.string.localizable.youAreAlmostDone()
        backView.addSubview(tipOneLabel)
        tipOneLabel.snp.makeConstraints { (make) in
            make.top.equalTo(successImageView.snp.bottom).offset(30)
            make.width.height.greaterThanOrEqualTo(0)
            make.centerX.equalToSuperview()
        }
        //tip two
        let tipTwoLabel = ContentLabel(R.font.interMedium(size: 13),hexStr: "#292D3299")
        tipTwoLabel.text = R.string.localizable.thankYouForYourInterestInRegisteringAnAccountWithGreenDealWithOurPlatformYouWillStreamlineYourSolarBusinessYourApplicationHasBeenReceivedByOurAdministrationTeamAndWeWillProcessItShortlyIfYouHaveAnyQuestionsPleaseContactUsOn0733871810()
        tipTwoLabel.numberOfLines = 0
        tipTwoLabel.textAlignment = .center
        backView.addSubview(tipTwoLabel)
        tipTwoLabel.snp.makeConstraints { (make) in
            make.top.equalTo(tipOneLabel.snp.bottom).offset(12)
            make.left.right.equalToSuperview()
            make.height.greaterThanOrEqualTo(0)
            make.centerX.equalToSuperview()
        }
        
        //
        backView.addSubview(okBtn)
        okBtn.snp.makeConstraints { (make) in
            if APPConfig.WidthForPortrait == 320 {
                make.top.equalTo(tipTwoLabel.snp.bottom).offset(10)
            }else{
                make.top.equalTo(tipTwoLabel.snp.bottom).offset(40)
            }
            make.width.equalTo(200)
            make.height.equalTo(OperationButton.height)
            make.centerX.bottom.equalToSuperview()
        }
    }

}
